from ogreEx.blender.types import Operator
from ogreEx.config import save_config
from ogreEx.config import CONFIG_FILEPATH
from ogreEx.CReportSingleton import Report
from ogreEx.ui.UIClass import OPERATOR

@OPERATOR
class Blender2Ogre_ConfigOp(Operator):
    '''operator: saves current b2ogre configuration'''
    bl_idname = "ogre.save_config"
    bl_label = "save config file"
    bl_options = {'REGISTER'}
    
    @classmethod
    def poll(cls, context): 
        return True
    def invoke(self, context, event):
        save_config()
        Report.reset()
        Report.messages.append('SAVED %s' %CONFIG_FILEPATH)
        Report.show()
        return {'FINISHED'}